package com.zjweu.hkg.DTO;

import com.zjweu.hkg.POJO.Article;
import com.zjweu.hkg.POJO.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ArticleWithTagsDTO {
    private Article article;


    private List<String> tagNames;  // 标签名称的集合

    private User author;

    public static Article convert2Article(ArticleWithTagsDTO articleWithTagsDTO){
        return new Article(articleWithTagsDTO.article.getArticleId(),
                articleWithTagsDTO.article.getArticleTitle(),
                articleWithTagsDTO.article.getArticleContent(),
                articleWithTagsDTO.article.getAuthorUID(),
                articleWithTagsDTO.article.getCreateDate(),
                articleWithTagsDTO.article.getUpdateDate(),
                articleWithTagsDTO.article.getReadTime(),
                articleWithTagsDTO.article.getArticleUUID(),
                articleWithTagsDTO.article.getPermission(),
                articleWithTagsDTO.article.getStatus()
        );
    };

}
